﻿<base:IndexPanelBase xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                     xmlns:base="clr-namespace:Rio.Framework.Pages.Controls.BaseClass"
                     xmlns:controls="clr-namespace:Rio.Framework.Pages.Controls"
                     xmlns:criterias="clr-namespace:Rio.Framework.Pages.CriteriaControls"
                     x:Class="Rio.Framework.Pages.Controls.IndexPanel"
                     x:Name="UCSearchPanel"
                     d:DesignHeight="700"
                     d:DesignWidth="330"
                     mc:Ignorable="d">

    <base:IndexPanelBase.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Assets/Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </base:IndexPanelBase.Resources>

    <Grid x:Name="LayoutRoot">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="IndexPanelStates">
                <VisualState x:Name="Default" />
                <VisualState x:Name="Minimized">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="buttonClear">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="buttonToSearch">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="TextBlockToIndex">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)"
                                                       Storyboard.TargetName="radToolBar">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <HorizontalAlignment>Left</HorizontalAlignment>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1"
                                 MappingMode="RelativeToBoundingBox"
                                 StartPoint="0.5,0">
                <GradientStop Color="#FFE9E9E9" />
                <GradientStop Color="#FFF0F0F0"
                              Offset="0.388" />
            </LinearGradientBrush>
        </Grid.Background>

        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        
        <telerik:RadOutlookBar x:Name="radOutlookBar"
                               SelectedIndex="0" 
                               IsVerticalResizerVisible="False"
                               HorizontalAlignment="Stretch"
                               IsContentPreserved="True"
                               Template="{StaticResource RadOutlookBarControlTemplate}"
                               MinimizedWidth="44"
                               MinimizedWidthThreshold="44"
                               MinimizedButtonContent="{Binding SelectedItem.Header, ElementName=radOutlookBar, Mode=TwoWay}"
                               Width="330"
                               MinimizedAreaVisibility="Collapsed" DropDownDisplayMode="Visible">
            <telerik:RadOutlookBarItem Name="indexBarItem" Header="Index"
                                       Icon="/Rio.Framework.Pages;component/Assets/Images/indexBig.png"
                                       SmallIcon="/Rio.Framework.Pages;component/Assets/Images/indexSmall.png"
                                       Style="{StaticResource RadOutlookBarItemStyle}"
                                       HorizontalAlignment="Stretch">
                <Grid Background="#FFEFEFEF">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <controls:UCOrganizationTypePanel x:Name="uCOrganizationType" Margin="0" />
                    <ScrollViewer x:Name="indexScrollViewer"
                                  Grid.Row="1"
                                  Background="White"
                                  ScrollViewer.VerticalScrollBarVisibility="Auto">
                        <ContentControl x:Name="indexContentControl">
                            <criterias:StackIndexControl x:Name="stackIndex"
                                                         IsSearchMode="False"
                                                         ChronoNumberGenerated="StackIndex_ChronoNumberGenerated" 
                                                         CurrentOrganization="{Binding m_oOrganization, ElementName=UCSearchPanel, Mode=TwoWay}" 
                                                         CurrentFolderType="{Binding m_oFolderType, ElementName=UCSearchPanel, Mode=TwoWay}"
                                                         CurrentFolder="{Binding CurrentFolder, ElementName=UCSearchPanel, Mode=TwoWay}" 
                                                         UseChronoGeneration="{Binding UseChronoGeneration, ElementName=UCSearchPanel, Mode=TwoWay}"/>
                        </ContentControl>
                    </ScrollViewer>
                    <StackPanel Margin="5,0,0,0" Orientation="Horizontal" Grid.Row="2">
                    	<StackPanel
                    		d:LayoutOverrides="GridBox"
                    		Orientation="Vertical">
                            <CheckBox x:Name="checkBoxFullText" IsChecked="True"  />
                    		<CheckBox x:Name="checkBoxKeepCriteria" IsChecked="True" />
                        </StackPanel>
                        <StackPanel
                    		d:LayoutOverrides="GridBox"
                    		Orientation="Vertical">
                            <CheckBox x:Name="checkBoxProcessCAB" IsChecked="False" Margin="5,0,0,0" Click="checkBoxProcessCAB_Click" />
                            <CheckBox x:Name="checkBoxProcessLAD" IsChecked="False" Margin="5,0,0,0" Click="checkBoxProcessLAD_Click" />
                        </StackPanel>
                    </StackPanel>
                </Grid>
            </telerik:RadOutlookBarItem>
            <telerik:RadOutlookBarItem x:Name="itemsPanelControl" 
                                       Header="{Binding CurrentSelectedItem, Converter={StaticResource ItemNameToOutlookBarItem}, ElementName=treeViewControlItems, Mode=TwoWay}"
                                       Icon="/Rio.Framework.Pages;component/Assets/Images/itemsBig.png"
                                       SmallIcon="/Rio.Framework.Pages;component/Assets/Images/itemsSmall.png"
                                       HorizontalAlignment="Stretch"
                                       Style="{StaticResource RadOutlookBarItemStyle}">
                <Grid>
                    <criterias:ItemTreeview x:Name="treeViewControlItems"
                                            IsSearchMode="False"
                                            VerticalAlignment="Stretch"
                                            VerticalContentAlignment="Stretch" />
                </Grid>
            </telerik:RadOutlookBarItem>
            <telerik:RadOutlookBarItem x:Name="documentInformationsPanelControl"
                                       Icon="/Rio.Framework.Pages;component/Assets/Images/infoBig.png"
                                       SmallIcon="/Rio.Framework.Pages;component/Assets/Images/infoSmall.png"
                                       HorizontalAlignment="Stretch"
                                       Style="{StaticResource RadOutlookBarItemStyle}">
                <Grid Background="#FFEFEFEF">
                    <StackPanel x:Name="propertiesStackPanel"
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Stretch" >

                        <TextBlock x:Name="labelAuthor"
                                   Style="{StaticResource LabelControleDocumentStyle}" />
                        <TextBox x:Name="textboxAuthor"
                                 Style="{StaticResource TextBoxControleDocumentStyle}"
                                 MaxWidth="260"
                                 MaxLength="50"
                                 GotFocus="L_oUiElementIndexControl_GotFocus" />

                        <TextBlock x:Name="labelNote"
                                   Style="{StaticResource LabelControleDocumentStyle}" />

                        <TextBox Margin="5,0,15,0"
                                 Height="60"
                                 MaxWidth="260"
                                 AcceptsReturn="True"
                                 x:Name="textboxNote"
                                 Style="{StaticResource TextBoxControleDocumentStyle}"
                                 TextWrapping="Wrap"
                                 HorizontalScrollBarVisibility="Auto"
                                 VerticalScrollBarVisibility="Auto"
                                 MaxLength="1024"
                                 GotFocus="L_oUiElementIndexControl_GotFocus" />
                    </StackPanel>
                </Grid>
            </telerik:RadOutlookBarItem>
        </telerik:RadOutlookBar>
        
        <telerik:RadToolBar x:Name="radToolBar"
                            Grid.Row="1"
                            Height="30"
                            GripVisibility="Collapsed"
                            HorizontalAlignment="Stretch" 
                            OverflowButtonVisibility="Collapsed">

            <telerik:RadButton x:Name="buttonClear"
                               IsEnabled="False"
                               Command="{Binding ClearCriteriaCommand, ElementName=UCSearchPanel }">
                <StackPanel Orientation="Horizontal">
                    <Image Width="16"
                           Height="16"
                           Margin="0,0,2,0"
                           Source="/Rio.Framework.Pages;component/Assets/Images/Clear.png" />
                    <TextBlock x:Name="TextBlockClear"
                               VerticalAlignment="Center" />
                </StackPanel>
            </telerik:RadButton>
            <telerik:RadButton x:Name="buttonToSearch"
                               IsEnabled="False"
                               HorizontalAlignment="Stretch"
                               Command="{Binding SearchCommand, ElementName=UCSearchPanel }">
                <StackPanel Orientation="Horizontal">
                    <Image Width="16"
                           Height="16"
                           Margin="0,0,2,0"
                           Source="/Rio.Framework.Pages;component/Assets/Images/SearchBinoculars.png" />
                    <TextBlock x:Name="TextBlockToSearch"
                               VerticalAlignment="Center" />
                </StackPanel>
            </telerik:RadButton>
            <telerik:RadButton x:Name="buttonToIndex"
                               IsEnabled="False"
                               HorizontalAlignment="Stretch"
                               Command="{Binding IndexCommand, ElementName=UCSearchPanel }">
                <StackPanel Orientation="Horizontal">
                    <Image Width="16"
                           Height="16"
                           Margin="0,0,2,0"
                           Source="/Rio.Framework.Pages;component/Assets/Images/Validate.png" />
                    <TextBlock x:Name="TextBlockToIndex"
                               VerticalAlignment="Center" />
                </StackPanel>
            </telerik:RadButton>

            <!--<telerik:RadSplitButton x:Name="buttonToIndex"
                                    Command="{Binding IndexCommand, ElementName=UCSearchPanel }">
                <telerik:RadSplitButton.DropDownContent>
                    <ListBox Width="185"
                             x:Name="ListBoxValidate"
                             >
                        <ListBoxItem x:Name="buttonRunOcr">
                            <StackPanel Orientation="Horizontal">
                                <Image Width="20"
                                       Height="20"
                                       Source="/Rio.Framework.Pages;component/Assets/Images/RunOCR.png" />
                                <TextBlock x:Name="TextBlockRunOcr"
                                           Text="Traitement OCR"
                                           Margin="5 0 0 0"
                                           VerticalAlignment="Center" />
                            </StackPanel>
                        </ListBoxItem>
                        <ListBoxItem x:Name="buttonCAB">
                            <StackPanel Orientation="Horizontal">
                                <Image Width="20"
                                       Height="20"
                                       Source="/Rio.Framework.Pages;component/Assets/Images/barcode.png" />
                                <TextBlock x:Name="TextBlockCAB"
                                           Text="Traitement CAB"
                                           Margin="5 0 0 0"
                                           VerticalAlignment="Center" />
                            </StackPanel>
                        </ListBoxItem>
                    </ListBox>
                </telerik:RadSplitButton.DropDownContent>
                <StackPanel Orientation="Horizontal">
                    <Image Width="16"
                           Height="16"
                           Margin="0,0,2,0"
                           Source="/Rio.Framework.Pages;component/Assets/Images/Validate.png" />
                    <TextBlock x:Name="TextBlockToIndex"
                               VerticalAlignment="Center" />
                </StackPanel>
            </telerik:RadSplitButton>-->
        </telerik:RadToolBar>
    </Grid>

</base:IndexPanelBase>